package org.travel_system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.travel_system.mapper.HotelMapper;
import org.travel_system.pojo.Hotel;
import org.travel_system.pojo.Room;
import org.travel_system.service.HotelService;

import java.util.List;

@Service
public class HotelServiceImpl implements HotelService {

    private final HotelMapper hotelMapper;

    @Autowired
    public HotelServiceImpl(HotelMapper hotelMapper) {this.hotelMapper = hotelMapper;}

    @Override
    public List<Hotel> getHotels() {
        return hotelMapper.getHotels();
    }

    public List<Hotel> getHotelsImage(){
        return hotelMapper.getHotelsImage();
    }
    @Override
    public Hotel getHotelByName(String name) {
        return hotelMapper.getHotelByName(name);
    }

    @Override
    public List<Hotel> getSearchHotelsByName(String name) {
        return hotelMapper.getHotelsByName(name);
    }

    @Override
    public int deleteHotel(String name) {
        return hotelMapper.deleteHotel(name);
    }

    @Override
    public int updateHotel(Hotel hotel) {
        return hotelMapper.updateHotel(hotel);
    }

    @Override
    public int addHotel(Hotel hotel) {
        return hotelMapper.addHotel(hotel);
    }

    @Override
    public List<Room> getRooms(String hotelName) {
        return hotelMapper.getRooms(hotelName);
    }

    @Override
    public Room getRoomByRoomNumber(String hotelName, int roomNumber) {
        return hotelMapper.getRoomByRoomNumber(hotelName,roomNumber);
    }

    @Override
    public int addRoom(Room room) {

        return hotelMapper.addRoom(room);
    }

    @Override
    public int deleteRoom(String hotelName, String roomNumber) {
        return hotelMapper.deleteRoom(hotelName,roomNumber);
    }

    @Override
    public int updateRoom(Room room) {
        return hotelMapper.updateRoom(room);
    }

    @Override
    public List<Room> getAllRooms() {
        return hotelMapper.getAllRooms();
    }
}
